import { get, post, put, del } from "../utils/request";

/**
 * 获取列表
 * @returns
 */
export const loadDataAPI = (name="",page = 1, per = 10) =>
  get("/api/v1/admin/product", { page, per,name });

/**
 * 根据id获取一个
 * @param id
 * @returns
 */
export const loadDataByIdAPI = (id: string) =>
  get("/api/v1/admin/product/" + id);

/**
 * 创建数据
 * @param data
 * @returns
 */
export const createAPI = (data: any) =>
  post("/api/v1/admin/product", data);

/**
 * 根据id修改
 * @param id
 * @param data
 * @returns
 */
export const updateByIdAPI = (id: string, data: any) =>
  put("/api/v1/admin/product/" + id, data);

/**
 * 根据id删除
 * @param id
 * @returns
 */
export const deleteByIdAPI = (id: any) =>
  del("/api/v1/admin/product/" + id);
